Use the portal when sandboxed
authorMatthias Clasen <mclasen@redhat.com>
Sat, 11 Jun 2016 14:23:27 +0000 (10:23 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 8 Jul 2016 04:08:05 +0000 (00:08 -0400)
Use the sandbox helper api to find out whether to use
the file chooser portal.

https://bugzilla.gnome.org/show_bug.cgi?id=768499

gtk/gtkfilechoosernativeportal.c

index 348c402bd7e7fb6ecce6640169153449d16ee224..8a52a477534637d6485d6ab7ef001c264fba8497 100644 (file)
@@ -277,14 +277,7 @@ gtk_file_chooser_native_portal_show (GtkFileChooserNative *self)
   const char *signal_name;
   GDBusSignalCallback signal_callback;
 
-  if (g_getenv ("GTK_USE_PORTAL") == NULL)
-    return FALSE;
-
-  if (gtk_file_chooser_get_extra_widget (GTK_FILE_CHOOSER (self)) != NULL)
-    return FALSE;
-
-  update_preview_signal = g_signal_lookup ("update-preview", GTK_TYPE_FILE_CHOOSER);
-  if (g_signal_has_handler_pending (self, update_preview_signal, 0, TRUE))
+  if (!gtk_should_use_portal ())
     return FALSE;
 
   connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);